#include "Function.h"

#include <stdlib.h>
#include <string.h>
#include <stdio.h>

SCommManager CommManager;
SScoreTab scoreTab;

SInfoClient* GetInfoClient(){
	SInfoClient *info=(SInfoClient*)malloc(sizeof(SInfoClient));

	strcpy(info->NameStrategy,"Boul's strat");
	strcpy(info->NameAuthor,"Thomas Hillion");
	info->Version[0]=0;
	info->Version[1]=0;
	info->Version[2]=0;
	info->Version[3]=0;

	return(info);
}

void ReleaseInfoClient(SInfoClient *info){
	deleteScoreTab(&scoreTab);
	afficheScoreTab(&scoreTab);
	free(info);
	printf("Toute la mémoire est propre\nAurevoir\n");
}

void Initialize(unsigned int idTeam, unsigned int nbTeam, unsigned int nbCell){
	// Interrogation possible du contenu d'une cellule et de la nature de son voisinage
	//SCell **NeighborCell;
	
	printf("------------##INFOS numero_equipe(%u)\n------------##nombre_equipe(%u)\n------------##numeroCell(%u)\n",idTeam, nbTeam, nbCell);
	
	CreateTabScore(&scoreTab, nbTeam, idTeam);
	
	updateScoreTab(&CommManager, &scoreTab, nbCell);
	printf("\\update\n");
	afficheScoreTab(&scoreTab);

	
}



void GetActions(const SAlliance ** const alliances, unsigned int nbUnit){
	// Interrogation possible du contenu d'une cellule et de la nature de son voisinage
	/*
	unsigned int i;

	printf("Client : GetActions ; nbUnit(%u)\n",nbUnit);
	for(i=0;alliances[i];i++)
		printf("Client: Request alliance ; idTeam(%d) - idCell(%d)\n",alliances[i]->idTeam,alliances[i]->idCell);

	UActionParam param;

	param.ActionMove.idCell=34;
	CommManager.SendAction(2,ACT_Move,param);

	param.ActionSupport.idTeam=3;
	param.ActionSupport.idCell=12;
	CommManager.SendAction(1,ACT_Support,param);

	param.ActionTransport.idCellSource=4;
	param.ActionTransport.idCellDestination=14;
	CommManager.SendAction(3,ACT_Transport,param);
	 */
}

void GetAlliances(unsigned int nbTeam){
	// Interrogation possible du contenu d'une cellule et de la nature de son voisinage
	//printf("Client : GetAlliances ; nbTeam(%d)\n",nbTeam);
	//CommManager.AskAlliance(1,13);
	//CommManager.AskAlliance(3,34);
	
}

void AddUnit(unsigned int nb,SUnit *unit){
	/*
	// Interrogation possible du contenu d'une cellule et de la nature de son voisinage

	unsigned int i;

	for (i=0;i<nb;i++)
	{
		unit[i].idCell=5;
		unit[i].type=UT_Army;
	}
	 */
}

void RemoveUnit(unsigned int nb,unsigned int *idUnit){
	// Interrogation possible du contenu d'une cellule et de la nature de son voisinage
	/*
	unsigned int i;

	for (i=0;i<nb;i++)
		idUnit[i]=i;
	 */
}
